package com.robaone.gwt.hierarcialdb.client.ui.admin;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.robaone.gwt.hierarcialdb.client.state.AdminState;

public class FolderUi extends Composite {
	private String id;
	private static FolderUiUiBinder uiBinder = GWT
			.create(FolderUiUiBinder.class);

	interface FolderUiUiBinder extends UiBinder<Widget, FolderUi> {
	}

	public FolderUi(String foldername,String id) {
		initWidget(uiBinder.createAndBindUi(this));
		this.filename.setText(foldername);
		this.setId(id);
	}

	@UiField Image icon;
	@UiField Label filename;
	
	@UiHandler("icon")
	public void handleIconClick(ClickEvent event){
		AdminState.showFolder(this.getId());
	}
	
	@UiHandler("filename")
	public void handleFileNameClick(ClickEvent event){
		
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}
}
